package com.wy2.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.wy2.entity.Student;
import com.wy2.mapper.zxStuMapper;
import com.wy2.service.zxStuService;
import com.wy2.util.FenyeUtil;

@Service
public class zxStuServiceImpl implements zxStuService {
	
	@Autowired
	private zxStuMapper zsm;
	/**
	 * 分页查询
	 */
	@Override
	public FenyeUtil<Student> getAll(FenyeUtil<Student> fenye) {
		Integer count = zsm.getCountZx(fenye);
		List<Student> data = zsm.getDataZx(fenye);
		if(data.size()>0) {
			fenye.setCount(count);
			fenye.setData(data);
		}else {
			fenye.setCode(1);
			fenye.setMsg("无数据");
		}
		return fenye;
	}

	@Override
	public Integer addStudent(Student s) {
		// TODO Auto-generated method stub
		return zsm.addStudent(s);
	}

	@Override
	public Integer delStudent(Integer sid) {
		// TODO Auto-generated method stub
		return zsm.delStudent(sid);
	}

	@Override
	public Integer updStudent(Student s) {
		// TODO Auto-generated method stub
		return zsm.updStudent(s);
	}

	@Override
	public Integer updateExt(Integer sid) {
		// TODO Auto-generated method stub
		return zsm.updateExt(sid);
	}


	@Override
	public FenyeUtil<Student> findByExt(FenyeUtil<Student> fenye) {
		
		List<Student> slist = zsm.findByExt(fenye);
		Integer count = zsm.getCountExt(fenye);
		if(slist.size()>0) {
			fenye.setCount(count);
			fenye.setData(slist);
		}else {
			fenye.setCode(1);
			fenye.setMsg("无数据");
		}
		return fenye;
	}

	@Override
	public List<Student> Stel(String stel) {
		// TODO Auto-generated method stub
		return zsm.Stel(stel);
	}

	@Override
	public List<Student> Sqq(String sqq) {
		// TODO Auto-generated method stub
		return zsm.Sqq(sqq);
	}

	@Override
	public List<Student> Schart(String schart) {
		// TODO Auto-generated method stub
		return zsm.Schart(schart);
	}

}
